package com.developer.platform.controller.system;

import com.developer.platform.application.query.QuartzJobQueryManager;
import com.developer.platform.application.query.dto.QuartzJobDto;
import com.developer.platform.application.query.dto.ResponseModel;
import com.developer.platform.controller.BaseController;
import com.veeker.core.bean.Pageable;
import com.veeker.log.annotations.Log;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：qiaoliang
 * @date ：2021-01-07
 */
@Api(tags = "定时任务管理")
@Validated
@RequestMapping("/system/quartz-job")
@RestController
public class QuartzJobController extends BaseController {

  private final QuartzJobQueryManager quartzJobQueryManager;

  public QuartzJobController(
      QuartzJobQueryManager quartzJobQueryManager) {
    this.quartzJobQueryManager = quartzJobQueryManager;
  }

  @Log(businessType = "定时任务管理",discription = "查询定时任务列表")
  @ApiOperation(value = "查询定时任务列表")
  @GetMapping
  public ResponseEntity<ResponseModel<QuartzJobDto>> list(Pageable pageable){
    return ok(quartzJobQueryManager.list(pageable));
  }

}
